package jobscheduling.algorithms.bee;

import java.util.Arrays;
import jobscheduling.model.InputData;
import jobscheduling.model.SolutionEvaluator;

public class Solution{

	private int eval_;
	
	private int[] solution_;
	
	private Solution(){
		eval_ = 0;
		solution_ = null;
	}
	
	public Solution(InputData data, int[] solution){
		solution_ = solution.clone();
		eval_ = SolutionEvaluator.getEval(data, solution);
	}
	
	public Solution(InputData data, int[] solution, int i){
		solution_ = solution;
		eval_ = SolutionEvaluator.getEval(data, solution);
	}
	
	public int getEval(){
		return eval_;
	}
	
	public int[] getSolution(){
		return solution_;
	}
	
	public Solution getSolutionCopy(){
		Solution tmpSolution = new Solution();
		tmpSolution.solution_ = new int[this.solution_.length];
		tmpSolution.eval_ = this.eval_;
                System.arraycopy(this.solution_, 0, tmpSolution.solution_, 0, this.solution_.length);
		return tmpSolution;
	}
	
    @Override
	public String toString(){
		return this.getClass()+"("+eval_+", "+Arrays.toString(solution_)+")";
	}
}